#ifndef HOMEUI_H
#define HOMEUI_H

#include <QWidget>
#include "BaseWidget.h"
#include "WidgetId.h"
#include "AppLog.h"
#include <QKeyEvent>
#include <QTimer>
#include <QTime>

namespace Ui {
class HomeUi;
}

class HomeUi : public BaseWidget
{
    Q_OBJECT

public:
    explicit HomeUi(QWidget *parent = nullptr);
    ~HomeUi()override;
    void activate()override;
    void inactivate()override;

protected:
    void changeEvent(QEvent* e)override;
   // bool eventFilter(QObject *watched, QEvent *event)override;

private slots:
    void toastTimerSlot();

    void syncTimerSlot();

    void recordTimerSlot();

    void on_imageSetting_clicked();

    void on_systemSetting_clicked();

    void on_addPatient_clicked();

    void on_queryPatient_clicked();

    void on_imagePlayback_clicked();

    void on_imageRotate_clicked();

    void on_imageExport_clicked();

    void HomeUi_Export_Slot();

    void on_gohome_clicked();

    void on_goback_clicked();


    void on_imageRotate_2_clicked();

    void on_pushButton_clicked();

    void on_pushButton_2_clicked();

public slots:
    void takePhotoSlot();
    void recordSlot();
    void updateToastSlot(int type, int value = 0);

private:
    int flag = 0;
    Ui::HomeUi *ui;
    QTimer* g_toastTimer;
    QTimer* g_syncTimer;
    QTime g_recordDuration;
    QTimer* g_recordTimer;
    int g_syncType = -1;
    bool m_isaction = true;
    bool m_allowSwitch = true;
    int m_rotate = 0;
    void syncInternalStorageInfo();
    void syncExternalStorageInfo();
    void updateTemperature();
    void internelStorgeNoEnough();
    void setMaskType();
    QFile *m_temperature = nullptr;
    uint8_t m_sensorType;
};

#endif // HOMEUI_H
